Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terrain/furniture: code deduplication and improved "copy-from" support #77637

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

ShnitzelX2
Copy link
Contributor

Summary

Infrastructure "terrain/furniture: code deduplication and improved copy-from support"

Purpose of change

Roughly the other half of #73211; copy-from terrain/furniture is a desirable feature

Closes #54702

Describe the solution

  • TRANSPARENT flag inherits correctly
  • flags support extend/delete
  • connect_groups, connects_to and rotates_to support copy-from
  • Removes legacy connects_to/rotates_to flag support (made possible by Remove reliance on legacy connection group flags #73415)
  • Merges some duplicate code in ter_t::load and furn_t::load into map_data_common_t::load
  • Makes map_X_bash_info and map_X_deconstruct_info optional, replaces bad "str_max > -1" checks

Sorry for the encroaching line count. A lot of the line "additions" are very minor, like '.' to '->'
This PR should not make any functional changes to gameplay.

Describe alternatives you've considered

What's left to be done (next on my to-do list):

  • symbol,color supports copy-from
  • remove LINE_OXOX and LINE_XOXO handling, replace it with better generic unicode character handling. The original PR attempted to do this, but it didn't work, so I didn't include it here.
  • handle bash, etc. special inheritance handling

Once all that's done, attempt to implement abstract furniture/terrain; there's a ton of JSON bloat that can be removed.

Testing

Passed all tests, clang-tidy should be good

Made sure the following work as usual:

  • deconstruct t_wall
  • smash t_wall until broken (STR 40)
  • repeat above with an identical copy-from child of t_wall
  • blow up bomb
  • burn down building
  • test breaking down a tent
  • using bolt cutters, hacksaw to cut a fence

I made five test walls and they all worked as expected, including connect groups and rotation:

  • test wall 1 copied from t_wall and added "extend": { "flags": ["TRANSPARENT"] }
  • test wall 2 copied test wall 1 and added "delete": { "flags": ["TRANSPARENT"] }
  • test wall 3 copied from t_wall and added "delete": { "flags": ["FLAMMABLE"] }
  • test wall 4 copied from test wall 2 and re-added "extend": { "flags": ["TRANSPARENT"] }
  • test wall 5 copied from t_window (for a rotation check)

Additional context

Proof for #54702: removed flags from t_deck_coating_no_roof_r and it's still transparent
image

As with last time, thanks to @Procyonae for writing the original PR, I just cleaned it up

@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Missions Quests and missions Map / Mapgen Overmap, Mapgen, Map extras, Map display Vehicles Vehicles, parts, mechanics & interactions Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Player Faction Base / Camp All about the player faction base/camp/site <Bugfix> This is a fix for a bug (or closes open issue) Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Nov 7, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Nov 7, 2024
@Maleclypse Maleclypse merged commit a835de3 into CleverRaven:master Nov 8, 2024
21 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display Missions Quests and missions Player Faction Base / Camp All about the player faction base/camp/site Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inheritance bug
2 participants